package ai.peanut.cloudtwo.controller;

import ai.peanut.cloudtwo.service.kafka.KafkaSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KaController {
    @Autowired
    private  KafkaSender sender ;

    @RequestMapping("/kafka")
    public int test(){


        for (int i = 0; i < 3; i++) {
            //调用消息发送类中的消息发送方法
            sender.send();

            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return 0 ;
    }
}
